<?php
if (!defined('IN_XLP')) {
    exit('Access Denied');
}
$Document = array(
    'pageid' => 'home-index', //页面标示
    'pagename' => '管理中心', //当前页面名称
    'mycss' => array(), //加载的css样式表
    'myjs' => array('content/Chart.min'), //加载的js脚本
	'footerjs'=>array('content/highcharts', 'content/exporting'),
    'head' => true, //加载头部文件
);

include getTpl('header', 'public');
?>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->
  <section id="content">
    <!-- main padder --> 
    <section class="main padder">
        <div class="clearfix"> 
			<h4><i class="fa fa-table"></i><?php echo trim($Document['pagename'],'_');?></h4> 
        </div>
		
        <div class="row">
			<!-- table 11 -->
			<div class="col-lg-12"> 
				<section class="panel"> 
					<header class="panel-heading">
					用户统计
                    <!-- <a href="<?php echo U('home/stat');?>" style="float:right;">详细数据</a> -->
					</header> 
					<div class="panel-body"> 
						<div class="row text-small"> 
							<div class="col-sm-12 m-b-mini">
                            <div id="container" style="margin:5px auto"></div>
									<!-- <div class="alert alert-warning alert-block"> 
                                       <button data-dismiss="alert" class="close" type="button"><i class="fa fa-times"></i></button> 
                                       <h4><i class="fa fa-bell-o"></i>提示信息</h4> 
                                       <p>这里只展示近7天统计情况，更多统计请 <a href="<?php echo U('home/stat');?>">点击查看>></a></p> 
                                    </div> -->
							</div>
						</div> 
					</div>
				</section> 
			</div> 
			<!--/ table 11 -->

        </div> 
    </section>
    <!--/ main padder -->  
  </section> 
  <!--/ content --> 
<!--主体 结束-->
<?php
if ($rs){
?>
<script>
$(function () {
        $('#container').highcharts({
            chart: {
                type: 'line',
                marginRight: 130,
                marginBottom: 25
            },
            title: {
                text: '最近7天数据走势分析',
                x: -20 //center
            },
            subtitle: {
                text: '',
                x: -20,
				y:5
            },
            xAxis: {
                categories: [<?php echo "'".implode("','",$data['time'])."'";?>]
            },
            yAxis: {
                title: {
                    text: '数据走势（人）'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            tooltip: {
                valueSuffix: ''
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'top',
                x: -10,
                y: 100,
                borderWidth: 0
            },colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
            series: [{
                name: '新增关注用户',
                data: [<?php echo implode(',',$data['new_user']);?>]
            },{
                name: '用户流失',
                data: [<?php echo implode(',',$data['new_cancel']);?>]
            }]
        });
    });
</script>
<?php
}
?> 
<script>
var doughnutData1 = [
    {
        value: <?php echo $members['total']; ?>,
        color:"#F7464A",
        highlight: "#FF5A5E",
        label: "会员总数"
    },
    {
        value: <?php echo $members['normal']; ?>,
        color: "#46BFBD",
        highlight: "#5AD3D1",
        label: "普通会员"
    },
    {
        value: <?php echo $members['gold']; ?>,
        color: "#FDB45C",
        highlight: "#FFC870",
        label: "黄金会员"
    }

];

var doughnutData2 = [
    {
        value: <?php echo $orders['total']; ?>,
        color:"#FDB45C",
        highlight: "#FF5A5E",
        label: "订单总数"
    },
    {
        value: <?php echo $orders['apply']; ?>,
        color: "#46BFBD",
        highlight: "#5AD3D1",
        label: "申请中"
    },
    {
        value: <?php echo $orders['borrow']; ?>,
        color: "#FDB45C",
        highlight: "#FFC870",
        label: "借款中"
    },
    {
        value: <?php echo $orders['over']; ?>,
        color: "#949FB1",
        highlight: "#A8B3C5",
        label: "已完成"
    }

];
$(function(){
    var ctx1 = document.getElementById("chart1").getContext("2d");
    window.myDoughnut1 = new Chart(ctx1).Doughnut(doughnutData1, {responsive : true});

    var ctx2 = document.getElementById("chart2").getContext("2d");
    window.myDoughnut2 = new Chart(ctx2).Doughnut(doughnutData2, {responsive : true});
})
</script>
<?php
include getTpl('footer', 'public');
?>